#pragma once
#include "GLDrawable.h"

class GLBackground : public GLDrawable
{
	using Super = GLDrawable;

public:
	using Super::Super;

	void initData();
	void initTexture();

	void updateData();

	void paint(QOpenGLShaderProgram* program, const QMatrix4x4& mvpMat);

public:
	const qreal& scale() const
	{
		return mScale;
	}
	void setScale(const qreal& scale)
	{
		mScale = scale;
	}

	QSize backgroundSize() const
	{
		return mImage.size();
	}

private:
	QImage			   mImage;
	qreal			   mScale = 0.30;
	QOpenGLTexture*	   mTexture;
	QVector<QVector2D> mTextureCoords;
	QVector<QVector3D> mVertices;

	GLuint mVertexVBO	 = 0;
	GLuint mTexCoordsVBO = 0;
	GLuint mVAO			 = 0;
};
